package com.ysd.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import com.ysd.entity.User;
import com.ysd.entity.Verification;
import com.ysd.service.UserPasswordService;
import com.ysd.util.Result;

@Controller
public class UserPasswordController {

	
	@Autowired
	private UserPasswordService userPasswordService;
	
	
	@RequestMapping("updatePassword")
	@ResponseBody
	public String updatePassword(User user) {
	
	int	n=userPasswordService.findUpdateById(user);
		
		if(n>0) {
			return Result.toClient("0", "修改成功", null);
		} else {
			return Result.toClient("1", "修改失败", null);
		}
		
		
	}
	
	@RequestMapping("selPassword")
	@ResponseBody
	public Object selPassword(String email) {
		User u = userPasswordService.findPasswordByEmail(email);
		if (u != null) {
			return Result.toClient("0", "查询成功", u);
		} else {
			return Result.toClient("1", "查询失败", null);
		}
	}
}
